package com.koron.operation.classes.shift.bean.po;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.koron.bean.annocation.FillField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.function.Function;

/**
 * 交接班记录(ClassesShiftRecord)表实体类
 *
 * @author jzp
 * @since 2021-10-27
 */
@Data
@ApiModel(value = "交接班记录", description = "ClassesShiftRecord")
public class ClassesShiftRecord {

    @FillField
    @ApiModelProperty(value = "唯一id")
    private String id;

    /**
     * 排班方案id
     */
    @ApiModelProperty("排班方案id")
    private String scheduleId;

    /**
     * 本值班次id
     */
    @ApiModelProperty("本值班次id")
    private String thisShiftId;

    /**
     * 本值交班时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @ApiModelProperty("本值实际交班时间")
    private Date thisTime;

    /**
     * 下值班次id
     */
    @ApiModelProperty("下值班次id")
    private String nextShiftId;

    /**
     * 下值接班时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @ApiModelProperty("下值实际接班时间")
    private Date nextTime;

    /**
     * 状态。0隐藏，1显示
     */
    @ApiModelProperty("状态。0隐藏，1显示")
    private Integer status;

    @FillField
    @ApiModelProperty(value = "创建时间", hidden = true)
    private Date createTime;

    public int sortNum(Function<ClassesShiftRecord, Object> function) {
        return function.apply(this) == null ? 1 : 0;
    }
}
